<template>
	<view>
		<uni-search-bar placeholder="搜索职位" @confirm="shou" @cancel="getlist()" @clear="getlist()"></uni-search-bar>
		<u-swiper :height="250" :list="lun" :effect3d="true" :interval="3000"></u-swiper>
		<view class="u-demo">
			<swiper indicator-dots>
				<swiper-item>
					<view class="item-container">
						<view class="thumb-box" v-for="(item1, index1) in gzhiwei" :key="index1" v-if="index1<9"
							@click="toinde(item1.id)">
							<view class="item-menu-name">{{item1.professionName}}</view>
						</view>
					</view>
				</swiper-item>
				<swiper-item>
					<view class="item-container">
						<view class="thumb-box" v-for="(item1, index1) in gzhiwei" :key="index1" v-if="index1>9"
							@click="toinde(item1.id)">
							<view class="item-menu-name">{{item1.professionName}}</view>
						</view>
					</view>
				</swiper-item>
			</swiper>
		</view>

		<uni-group title="招聘列表">
			<uni-card v-for="(item,index) in zhao" @click="roxian(item.id)">
				<view style="color: #E43D33;">职位名称:{{item.name}}</view>
				<view>岗位职责:{{item.obligation}}</view>
				<view>公司地点:{{item.address}}</view>
				<view>薪资待遇:{{item.salary}}元</view>
			</uni-card>
		</uni-group>
		<view style="height: 20vh;"></view>
		<uni-group style="position: fixed;right: 0%;left: 0%;bottom: 0%;z-index: 99;">
			<view class="u-flex">
				<view style="width: 33.33%;padding: 20rpx;text-align: center;color: #007AFF;border: 1px solid black;">
					找工作</view>
				<view @click="tttindex()"
					style="width: 33.33%;padding: 20rpx;text-align: center;border: 1px solid black;">投递历史</view>
				<view @click="tttindex2()"
					style="width: 33.33%;padding: 20rpx;text-align: center;border: 1px solid black;">个人简历</view>

			</view>
		</uni-group>
	</view>
</template>

<script>
	import api from 'commer/apiURL.js'
	export default {
		data() {
			return {
				base: api.baseurl,
				lun: [],
				gzhiwei: [],
				zhao: [],
			}
		},
		onLoad() {
			this.getlun()
			this.getzhiwei()
			this.getlist()
		},
		onBackPress() {
			uni.switchTab({
				url: '../allserver'
			})
			return true
		},
		methods: {
			roxian(id){
				console.log(id)
				uni.navigateTo({
					url:'xiangq?id='+id
				})
			},
			tttindex() {
				uni.navigateTo({
					url: 'lod'
				})
			},
			tttindex2() {
				uni.navigateTo({
					url: 'user'
				})
			},
			shou(e) {
				this.zhao = this.zhao.filter((item) => {
					return item.name.indexOf(e.value) >= 0
				})
			},
			toinde(id) {
				this.getlist(id)
			},
			getzhiwei() {
				this.$get(this.base + '/prod-api/api/job/profession/list').then((res) => {
					this.gzhiwei = res.rows
				})
			},
			getlist(id) {
				this.$get(this.base + '/prod-api/api/job/post/list', {
					professionId: id
				}).then((res) => {
					this.zhao = res.rows
				})
			},
			getlun() {
				this.lun = []
				this.$get(this.base + '/prod-api/api/rotation/list').then((res) => {
					res.rows.forEach((item) => {
						this.lun.push({
							image: this.base + item.advImg,
							id: item.targetId
						})
					})
				})
			},
		}
	}
</script>

<style>
	.item-container {
		display: flex;
		flex-wrap: wrap;
	}

	.thumb-box {
		width: 33.33%;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		margin-top: 20rpx;
		/* border-bottom: 1px solid black; */
	}

	.item-menu-image {
		width: 50rpx;
		height: 50rpx;
	}
</style>
